import Vue from "vue";
import App from "./App";
import uView from "./common/uview-ui";

import cuCustom from "@/common/colorui/components/cu-custom.vue";
import share from "@/common/share.js";
import tools from "@/common/js/util.js";
import VueClipboards from 'vue-clipboard2'
Vue.use(VueClipboards);
import wLoading from "@/components/w-loading/w-loading.vue";
Vue.use(wLoading);

// 考虑规范性,使用 module.exports 导出,应该使用 require 引用
let Chinese = require("./static/locales/zh-CN.js");
let English = require("./static/locales/en-US.js");
let japanese = require("./static/locales/zh-RY.js");
let korean = require("./static/locales/zh-HW.js");

// VueI18n
import VueI18n from "vue-i18n";

// VueI18n
Vue.use(VueI18n);
// 注意下述代码务必放在代码 "Vue.prototype._i18n = i18n" 上方
const i18n = new VueI18n({
	// 默认语言
	locale: "en-US",
	// 引入语言文件
	messages: {
		"zh-CN": Chinese,
		"en-US": English,
		"zh-RY": japanese,
		"zh-HW": korean,
	},
});
// VueI18n
Vue.prototype._i18n = i18n;

Vue.mixin(share);
Vue.use(uView);
// import wLoading from "@/components/w-loading.vue";
// Vue.component('w-loading',wLoading)

Vue.prototype.$tools = tools;
uni.$showMsg = (title = "数据加载失败!", duration = 3000) => {
	uni.showToast({
		title,
		duration,
		icon: "none",
	});
};
uni.$showLoading = (title = "") => {
	uni.showLoading({
		title,
		mask: true,
	});
};

// Vue.prototype.$api = api;
Vue.component("cu-custom", cuCustom);
Vue.config.productionTip = false;
App.mpType = "app";

const app = new Vue({
	i18n,
	...App,
});
app.$mount();
